<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>confirm,prompt,location，reload/title>
    <script type="text/javascript">
        //弹出提示框
        function disp_confirm()
          {
          var r=confirm("Press a button")
          if (r==true)
            {
            document.write("You pressed OK!")
            }
          else
            {
            document.write("You pressed Cancel!")
            }
          }


        //弹出输入框
          function disp_prompt()
        {
        var name=prompt("Please enter your name","")
        if (name!=null && name!="")
            {
            document.write("Hello " + name + "!")
            }
        }


        // location 的用法
        function loc (){
            window.location.href = "http://www.163.com"
        }



        //刷新
        function rel() {
                window.location.reload();
            }

        

        </script>

        
</head>
<body>
    <input type="button" onclick="disp_confirm()"
value="Display a confirm box" />

<input type="button" onclick="disp_prompt()"
value="Display a prompt box" />

<input type="button" onclick="loc()"
value="跳转页面" />

<input type="button" onclick="rel()" value="重载页面" />

</body>
</html>